home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-25 | 1.2 KB | 51 lines | [TEXT/R*ch] |
- // SoupHacking.f
- // "Hacking in the Soup"
- // Kent Sandvik PIE DTS
-
- // This file contains a group of useful functions and
- // classes when you need to mess around with soups.
-
- // example of how to dump soup contents
- func DumpNameSoup()
- begin
- local theSoup, c, val;
-
- // get soup
- theSoup := GetStores()[0]:GetSoup("Names");
-
- // create a cursor
- local c := Query(theSoup, {type: 'index});
-
- // while valid entries, dump the name information out
- repeat
- begin
- val := c:Entry();
- if(val.name.class = 'person) then
- begin
- // modify this as you wish
- print(val.name.last);
- print(val.name.first);
- print(val.city);
- print("\n");
- end;
- end
- until (c:Next() = nil);
- end; // big end
-
-
- // example of how to creat a soup (delete all entries)
- // ex: CreateEmptySoup(GetStores()[0], "Haha", nil);
- // or: CreateEmptySoup(GetStores()[0], "Serious", '[{structure: slot, path: theSlotName, type: string}]);
-
- func CreateEmptySoup(store, soupName, indexes)
- begin
- local s := store:GetSoup(soupName); // get access to the soup
-
- if s then // if not NIL
- s:RemoveAllEntries(); // purge
- else
- s := store:CreateSoup(soupName, indexes);
-
- return s; // return the soup again
- end;
-